//
//  NSArray+NSArrayExtension.m
//  yuikemall
//
//  Created by Gang.Wang on 12-5-15.
//  Copyright (c) 2012年 yuike. All rights reserved.
//

#import "NSArray+NSArrayExtension.h"

@implementation NSArray (NSArrayExtension)

- (NSArray *) randomizedArray {  
    NSMutableArray *results = [NSMutableArray arrayWithArray:self];  
    
    int i = [results count];  
    while(--i > 0) {  
        int j = rand() % (i+1);  
        [results exchangeObjectAtIndex:i withObjectAtIndex:j];  
    }  
    
    return [NSArray arrayWithArray:results];  
}  

+ (BOOL) isNilOrEmpty:(NSArray *) array
{
    if (!array ||
        [array count] <= 0) {
        return TRUE;
    }
    
    return FALSE;
}
@end

@implementation NSMutableArray (NSArrayExtension)
+ (BOOL) isNilOrEmpty:(NSArray *) array
{
    if (!array ||
        [array count] <= 0) {
        return TRUE;
    }
    
    return FALSE;
}
@end